<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        input {
            color: #ccc;
        }
    </style>
</head>
<body>
    <input type="text" value="手机">
    <script>
        var te = document.querySelector('input');
        // onfocus获取焦点
        te.onfocus = function() {
            if(te.value === '手机') {
                te.value = '';
            }else {
                te.value = te.value;
            }
        }
        // onblur失去焦点
        te.onblur = function() {
            if(te.value === '') {
                te.value = '手机';
            }
        }
    </script>
</body>
</html>